package com.zmx.patients.adapter;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.wang.adapters.adapter.BaseAdapterRvList;
import com.wang.adapters.base.BaseViewHolder;
import com.zmx.patients.R;
import com.zmx.patients.pojo.Department;

import butterknife.BindView;
import butterknife.ButterKnife;
/**
*时间：2020/5/4 15:50
*功能：
*/
public class CheckDiseaseRightAdapter extends BaseAdapterRvList<CheckDiseaseRightAdapter.ViewHolder, Department> {


    public CheckDiseaseRightAdapter(Activity activity) {
        super(activity);
    }

    @Override
    protected void onBindVH(ViewHolder holder, int listPosition, Department s) {

        holder.mTvBiaoTi.setText(s.getF_name());

        holder.mRv.setLayoutManager(new GridLayoutManager(mActivity, 2));
        //此处为了简单，直接就是图片
        DepartmentRightItemApadter adapter = new DepartmentRightItemApadter(mActivity);



        holder.mRv.setAdapter(adapter);
        holder.mRv.setNestedScrollingEnabled(false);//设置内层rv不可滑动

        adapter.setListAndNotifyDataSetChanged(s.getLists());

    }

    @NonNull
    @Override
    protected CheckDiseaseRightAdapter.ViewHolder onCreateVH(ViewGroup parent, LayoutInflater inflater) {
        CheckDiseaseRightAdapter.ViewHolder holder = new CheckDiseaseRightAdapter.ViewHolder(inflater.inflate(R.layout.apadter_department_right, parent, false));
        return holder;
    }

    static class ViewHolder extends BaseViewHolder {

        @BindView(R.id.tv_liandongrightada_BiaoTi)
        TextView mTvBiaoTi;
        @BindView(R.id.rv_liandongrightada)
        RecyclerView mRv;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
